table of contents
PMREP(1) | General Commands Manual | PMREP(1) |
NAME¶
pmrep - performance metrics reporter
SYNOPSIS¶
pmrep [-CdGHLpruUVxz?] [-a archive] [-A align] [-b space-scale] [-c config] [-e derived] [-E lines] [-f format] [-F archive] [-h host] [-K spec] [-l delimiter] [-o output] [-O origin] [-P precision] [-q count-scale] [-s samples] [-S starttime] [-t interval] [-T endtime] [-w width] [-y time-scale] [-Z timezone] metricspec [...]
DESCRIPTION¶
pmrep is a customizable performance metrics reporting tool. Any available performance metric, live or archived, system and/or application, can be selected for reporting using one of the output alternatives listed below together with applicable formatting options.
pmrep collects the selected metric values through the facilities of the Performance Co-Pilot (PCP), see PCPIntro(1). The metrics to be reported are specified on the command line, in a configuration file, or both. Metrics can be automatically converted and scaled using the PCP facilities, either by default or by per-metric scaling specifications. In addition to the existing metrics, derived metrics can be defined using the arithmetic expressions described in pmRegisterDerived(3).
Unless directed to another host by the -h option, pmrep will contact the Performance Metrics Collector Daemon (PMCD, see pmcd(1)) on the local host.
The -a option causes pmrep to use the specified archive log rather than connecting to a PMCD. The -a and -h options are mutually exclusive.
The -L option causes pmrep to use a local context to collect metrics from DSO PMDAs (Performance Metrics Domain Agents, ``plugins'') on the local host without PMCD. Only some metrics are available in this mode. The -a, -h, and -L options are mutually exclusive.
The metrics of interest are named in the metricspec argument(s). If a metricspec specifies a non-leaf node in the Performance Metrics Name Space (PMNS), then pmrep will recursively descend the PMNS and report on all leaf nodes (i.e., metrics) for that metricspec. (Use for example pminfo(1) to list all the leaf nodes and their descriptions.)
A metricspec has three different forms. First, on the command line it can start with a colon (``:'') to indicate a metricset to be read from a pmrep configuration file (see pmrep.conf(5)) which can then consist of any number of metricspecs. Second, a metricspec starting with non-colon specifies a PMNS node as described above, optionally followed by metric formatting definitions (applicable only to leaf nodes). This so-called compact form of a metricspec is defined as follows:
metric[,label[,instance[,unit/scale[,type[,width]]]]]
A valid PMNS node (metric) is mandatory. It can be followed by a text label used by supporting output targets (such as csv and stdout, see below). The optional instance definition is currently unimplemented. An optional unit/scale is applicable for dimension-compatible, non-string, and (currently) non-raw metrics. (See below for supported unit/scale specifications.) By default, cumulative counter metrics are converted to rates. If the optional type field is set to raw then this rate conversion is disabled, unit/scale specification is (currently) ignored and raw values are reported instead. Finally, for supporting output targets (currently: stdout) a numeric width can be used to set the width of the output column for this metric. Too-wide numeric values for output will not be printed (apart from decimal places, numeric values will never be silently truncated). Too-wide strings will be truncated.
The following metricspec requests the metric kernel.all.sysfork to be reported under the label forks, converting to the default rate count/s in an 8 wide column. Although the definitions in this compact form are optional, they must always be provided in the order specified above.
kernel.all.sysfork,forks,,,,8
The third form of a metricspec is valid only in pmrep.conf(5).
Derived metrics are specified like PMNS leaf node metrics.
Configuration file parameters override the corresponding built-in default values (if any). Command line parameters override the corresponding configuration file parameters (if any).
COMMAND LINE OPTIONS¶
The available command line options are:
- -a
- Performance metric values are retrieved from the Performance Co-Pilot (PCP) archive log file identified by the base name archive. See also -u.
- --archive-folio
- Read metric source archives from the PCP archive folio (see mkaf(1)).
- -A
- When reporting archived metrics, force the initial sample to be aligned on the boundary of a natural time unit align. Refer to PCPIntro(1) for a complete description of the syntax for align.
- -b
- Unit/scale for space (byte) metrics, possible values include bytes, Kbytes, KB, Mbytes, MB, and so forth up to Ebytes. This option will not override possible per-metric specifications. See also pmParseUnitsStr(3).
- -c
- Specify the config file to use. The default is ./pmrep.conf. See pmrep.conf(5).
- -C
- Exit before reporting any values, but after parsing the configuration and metrics and printing possible headers.
- -d
- When replaying from an archive, this option requests that the prevailing real-time delay be applied between samples (see -t) to effect a pause, rather than the default behaviour of replaying at full speed.
- -e
- Specify derived performance metrics. If derived starts with a slash (``/'') or with a dot (``.'') it will be interpreted as a derived metrics configuration file, otherwise it will be interpreted as comma-separated derived metric expressions. For details see pmLoadDerivedConfig(3) and pmRegisterDerived(3).
- -E
- Repeat the header every lines of output.
- -f
- Use the format string for formatting the timestamp. The format will be used with Python's datetime.strftime method which is mostly the same as that described in strftime(3). An empty format string (i.e., '') will remove the timestamps from the output. The default is %H:%M:%S.
- -F
- Specify the output archive. See -o.
- -G
- Do not include global metrics in reporting (see pmrep.conf(5)).
- -h
- Fetch performance metrics from pmcd(1) on host, rather than the default localhost.
- -H
- Do not print any headers.
- -K
- When fetching metrics from a local context (see -L), the -K option may be used to control the DSO PMDAs that should be made accessible. The spec argument conforms to the syntax described in __pmSpecLocalPMDA(3). More than one -K option may be used.
- -l
- Specify the delimiter that separates each column of csv or stdout output. The delimiter may only be a single character. The default for stdout is two spaces (`` '') and comma (``,'') for csv.
- -L
- Use a local context to collect metrics from DSO PMDAs on the local host without PMCD. See also -K.
- -o
- Use output target for reporting. The default target is stdout. The available target alternatives are:
- archive
- Record metrics into a PCP archive which can later be replayed with PCP tools, including pmrep itself. See pcp-archive(5) and PCPIntro(1) for details about PCP archive files. Requires -F.
- csv
- Print metrics in CSV format (subject to formatting options).
- stdout
- Print metrics to stdout (format subject to formatting options).
- zabbix
- Send metrics to a Zabbix server. See pmrep.conf(5) for the needed Zabbix configuration parameters. This target is currently experimental.
- -O
- When reporting archived metrics, start reporting at origin within the time window (see -S and -T). Refer to PCPIntro(1) for a complete description of the syntax for origin.
- -p
- Print timestamps. By default no timestamps are printed.
- -P
- Use precision for numeric non-integer output values. If the value is too wide for its column width, precision is reduced one by one until the value fits, or not printed at all if it does not. The default is to use 3 decimal places (when applicable).
- -q
- Unit/scale for count metrics, possible values include count x 10^-1, count, count x 10, count x 10^2, and so forth from 10^-8 to 10^7. (These values are currently space-sensitive.) This option will not override possible per-metric specifications. See also pmParseUnitsStr(3).
- -r
- Output raw metric values, do not convert cumulative counters to rates. This option will override possible per-metric specifications.
- -s
- The argument samples defines the number of samples to be retrieved and reported. If samples is 0 or -s is not specified, pmrep will sample and report continuously (in real time mode) or until the end of the PCP archive (in archive mode). See also -T.
- -S
- When reporting archived metrics, the report will be restricted to those records logged at or after starttime. Refer to PCPIntro(1) for a complete description of the syntax for starttime.
- -t
- The default update interval may be set to something other than the default 1 second. The interval argument follows the syntax described in PCPIntro(1), and in the simplest form may be an unsigned integer (the implied units in this case are seconds). See also the -T option.
- -T
- When reporting archived metrics, the report will be restricted to those records logged before or at endtime. Refer to PCPIntro(1) for a complete description of the syntax for endtime.
When used to define the runtime before pmrep will exit, if no samples is given (see -s) then the number of reported samples depends on interval (see -t). If samples is given then interval will be adjusted to allow reporting of samples during runtime. In case all of -T, -s, and -t are given, endtime determines the actual time pmrep will run.
- -u
- When reporting archived metrics, by default values are reported according to the selected sample interval (-t option), not according to the actual record interval in an archive. To this effect PCP interpolates the values to be reported based on the records in the archive. With the -u option uninterpolated reporting is enabled, every recorded value for the selected metrics is reported and the requested sample interval (-t) is ignored.
So for example, if a PCP archive contains recorded values for every 10 seconds and the requested sample interval is 1 hour, by default pmrep will use an interpolation scheme to compute the values of the requested metrics from the values recorded in the proximity of these requested metrics and values for every 1 hour are reported. With -u every record every 10 seconds are used as such (the reported values are still subject to rate conversion, use -r to disable).
- -U
- Omit unit information from of headers.
- -V
- Display version number and exit.
- -w
- Set the stdout output column width. Strings will be truncated to this width. The default width is the shortest that can fit the metric label, the forced minimum is 3. This option will not override possible per-metric specifications.
- -x
- Print extended header.
- -y
- Unit/scale for time metrics, possible values include nanosec, ns, microsec, us, millisec, and so forth up to hours, hr. This option will not override possible per-metric specifications. See also pmParseUnitsStr(3).
- -z
- Use the local timezone of the host that is the source of the performance metrics, as identified by either the -h or the -a options. The default is to use the timezone of the local host.
- -Z
- Use timezone when displaying the date and time. Timezone is in the format of the environment variable TZ as described in environ(7).
- -?
- Display usage message and exit.
EXAMPLES¶
The following examples use the PCP facilities for collecting the metric values, no external utilities are needed. The examples expect the default configuration file to contain the metricset specifications.
Display network interface statistics on the local host:
$ pmrep network.interface.total.bytes
Display per-device disk reads and writes from the host server1 using two seconds interval and CSV output format:
$ pmrep -h server1 -o csv -t 2s disk.dev.read disk.dev.write
Display timestamped vmstat(8) like information using MBs instead of bytes and also include the number of in-use inodes:
$ pmrep -p -b MB vfs.inodes.count :vmstat
Display sar -w and sar -W like information at the same time from the PCP archive ./20150921.09.13 showing values recorded between 3 - 5 PM:
$ pmrep -a ./20150921.09.13 -S @15:00 -T @17:00 :sar-w :sar-W
Record all 389 Directory Server, XFS file system and CPU/disk/memory related metrics every five seconds for the next five minutes to the PCP archive ./a:
$ pmrep -o archive -F ./a -t 5s -T 5m ds389 xfs kernel.all.cpu disk mem
FILES¶
- ./pmrep.conf
- Default configuration file.
BUGS¶
No command line option can follow metrics.
Specifying instances is not yet supported.
PCP ENVIRONMENT¶
Environment variables with the prefix PCP_ are used to parametrize the file and directory names used by PCP. On each installation, the file /etc/pcp.conf contains the local values for these variables. The $PCP_CONF variable may be used to specify an alternative configuration file, as described in pcp.conf(5).
SEE ALSO¶
mkaf(1), PCPIntro(1), pcp(1), pcp-atop(1), pmcd(1), pmchart(1), pmcollectl(1), pmdiff(1), pmdumplog(1), pmdumptext(1), pminfo(1), pmiostat(1), pmlogextract(1), pmlogsummary(1), pmprobe(1), pmstat(1), pmval(1), sar(1), __pmSpecLocalPMDA(3), pmLoadDerivedConfig(3), pmParseUnitsStr(3), pmRegisterDerived(3), strftime(3), pcp-archive(5), pcp.conf(5), pmns(5), pmrep.conf(5), environ(7) and vmstat(8).
PCP | Performance Co-Pilot |